<template>
  <div class="insureEli_conter">
    <div style="text-align:right;margin-top: 10px;margin-right: 30px">
      <el-button type="primary" @click="getBack">返回</el-button>
    </div>
    <el-row class="row_top">
      <el-col :span="18">
        <div class="top_img" style="text-align: center">
          <img src="../../../assets/images/img.png" height="62" width="507"/>
        </div>
      </el-col>
      <el-col :span="6">
      </el-col>
    </el-row>
    <el-row class="el-row">
      <el-col :span="24">
        <div class="title">雇主责任保险（A）投保单 <span>No.</span></div>
      </el-col>

    </el-row>

    <el-row class="el-row">
      <el-col :span="24">
        <div class="explain">欢迎您到中国人寿财产保险股份有限公司投保！请您在投保前务必详细阅读相关保险条款，特别注意<span>责任免除、投保人及被保险人义务、赔偿处理</span>等内容，据实回答保险人就投保事项提出的相关询问，并用蓝色或黑色墨水笔如实填写投保单及附件。投保后相关内容若发生变动，请及时通知保险人。
        </div>
      </el-col>
    </el-row>


    <!--   中间内容添加投保信息-->

    <div class="tem_from">
      <el-form :model="formData" ref="formData" :rules="rules" label-width="120px">
        <h3 style="margin-left: 20px">1. 投保人信息</h3>
        <div class="infor">
          <el-form-item label="投保人名称" prop="name1">
            <el-input class="el-input" ref="name1" placeholder="请输入投保人姓名" v-model="formData.name1"></el-input>
          </el-form-item>
          <el-form-item label="联系人姓名" prop="contactPerson1">
            <el-input class="el-input" ref="contact1" placeholder="请输入联系人姓名" v-model="formData.contactPerson1"></el-input>
          </el-form-item>
          <el-form-item label="联系电话" prop="phone1">
            <el-input class="el-input" ref="phone1" placeholder="请输入联系方式" v-model="formData.phone1"></el-input>
          </el-form-item>
          <el-form-item label="通讯地址"  prop="mailAddress1">
            <el-input class="el-input" ref="mailAddress1"  placeholder="请输入通讯地址"
                      v-model="formData.mailAddress1"></el-input>
          </el-form-item>
          <el-form-item label="邮编" prop="emailCode1">
            <el-input class="el-input" ref="emailCode1" placeholder="请输入邮编"
                      v-model="formData.emailCode1"></el-input>
          </el-form-item>
          <el-form-item label="电子邮箱" prop="email1">
            <el-input class="el-input" ref="email1" placeholder="电子邮箱" v-model="formData.email1"></el-input>
          </el-form-item>
        </div>
        <el-row style="display: flex;flex-flow: wrap">
            <h3>2. 被保险人基本信息</h3>
            <div style="margin-left: 20px;"> </div>
            <el-form-item label="用工单位" prop="employerId2" style="margin-top: 20px">
              <el-select v-model="formData.employerId2" placeholder="请选择用工单位">
                <el-option
                  @click.native="getEmployer(item)"
                  v-for="item in Employer"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id">
                </el-option>
              </el-select>
            </el-form-item>
        </el-row>
        <div class="infor">
          <el-form-item :model="formData" label="被保险人名称" prop="name2">
            <el-input class="el-input" ref="name2" placeholder="请输入被保险人名称" v-model="formData.name2"></el-input>
          </el-form-item>
          <el-form-item label="联系人姓名" prop="contactPerson2">
            <el-input class="el-input" ref="contact2" placeholder="请输入联系人姓名" v-model="formData.contactPerson2"></el-input>
          </el-form-item>
          <el-form-item label="联系人电话" prop="phone2">
            <el-input class="el-input" ref="phone2" placeholder="请输入联系方式" v-model="formData.phone2"></el-input>
          </el-form-item>
          <el-form-item label="通讯地址"  prop="mailAddress2">
            <el-input class="el-input" ref="mailAddress2" placeholder="请输入通讯地址"
                      v-model="formData.mailAddress2"></el-input>
          </el-form-item>
          <el-form-item label="邮编" prop="emailCode2">
            <el-input class="el-input" ref="emailCode2" placeholder="请输入邮编"
                      v-model="formData.emailCode2"></el-input>
          </el-form-item>
          <el-form-item label="电子邮箱" prop="email2">
            <el-input class="el-input" ref="email2" placeholder="电子邮箱" v-model="formData.email2"></el-input>
          </el-form-item>
        </div>
        <div style="margin-left: 20px"><h3>3. 被投保人性质</h3></div>
        <div class="infor1">
          <!--          <el-form-item >-->
          <el-radio-group v-model="formData.nature2">
            <el-radio
              v-for="dict in statusOptions"
              :key="dict.dictValue"
              :label="dict.dictValue"
            >{{ dict.dictLabel }}
            </el-radio>
          </el-radio-group>
          <!--          </el-form-item>-->
        </div>
        <div class="infor1_Industry">
          <span>请说明所在行业</span>
          <el-input style="width: 700px" type="textarea" :rows="5" v-model="formData.industry"></el-input>
        </div>
        <div class="infor2 infor3" style="margin-left: 20px">
          <h3>4. 被保险人地址/营业场所:</h3>

          <el-input style="margin-left: 20px;width: 700px" type="textarea" :rows="5" v-model="formData.address2"></el-input>
        </div>
        <div class="infor2 infor3" style="margin-left: 20px">
          <h3>5. 被保险人营业范围:</h3>

          <el-input style="margin-left: 20px;width: 700px" type="textarea" :rows="5" v-model="formData.businessScope2"></el-input>
        </div>
        <div class="infor2 " style="margin-left: 20px;display: flex;flex-flow: wrap">
          <h3 style="margin-right: 5px">6. 被保险人工作人员总人数:</h3>
          <el-input class="input" v-model="formData.staffCount2"></el-input>
          <div>人</div>
        </div>
        <el-row class="el-row ">
          <el-col :span="24">
            <div class="grid-content" style="display: flex;flex-direction: column">
              <span >其中高级职员姓名，职务，健康情况，请说明:</span>
              <el-input
                style="margin-top: 20px;width: 700px"
                type="textarea"
                :rows="5"
                placeholder="请输入内容"
                v-model="formData.seniorDescription">
              </el-input>
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content" style="display: flex;flex-direction: column">
              <span>其他类型工作人员说明（如工作类型、人数、健康情况）:</span>
              <el-input
                style="margin-top: 20px;width: 700px"
                type="textarea"
                :rows="5"
                placeholder="请输入内容"
                v-model="formData.generalDescription">
              </el-input>
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="7">
            <div class="grid-content bg-purple"> 注：如必要，请附工作人员基本情况清单。</div>
          </el-col>

        </el-row>
        <el-row style="display: flex;flex-flow: wrap;align-items: center">
            <div class="grid-content1" style="margin-right: 20px;"><h3>7. 过去三年是否投保过与雇主责任相关的保险？</h3></div>
            <el-radio-group v-model="formData.isELI">
              <el-radio
                v-for="dict in statusOptions1"
                :key="dict.dictValue"
                :label="dict.dictValue"
              >{{ dict.dictLabel }}
              </el-radio>
            </el-radio-group>
          <div class="grid-content" style="margin: 0 20px;">过去三年损失情况如何？</div>
          <el-radio-group v-model="formData.isLossEli">
            <el-radio
                v-for="dict in statusOptions2"
                :key="dict.dictValue"
                :label="dict.dictValue"
            >{{ dict.dictLabel }}
            </el-radio>
          </el-radio-group>
        </el-row>

        <div v-if="formData.isELI=='1' || formData.isLossEli=='1'">
        <el-row>
          <el-col :span="5">
            <div class="grid-content">如果有，请说明:</div>
          </el-col>
          <el-col :span="4">
            <div>
              保险期间
            </div>
          </el-col>
          <el-col :span="4">
            <div>
              保险人数
            </div>
          </el-col>
          <el-col :span="4">
            <div>
              损失情况
            </div>
          </el-col>
          <el-col :span="4">
            <div>
              获赔情况
            </div>
          </el-col>
        </el-row>
        <div style="margin: 0 20px 20px 40px">
          <el-input
            style="width: 700px"
            class="input1"
            type="textarea"
            :rows="5"
            placeholder="请输入内容"
            v-model="formData.eliDesc">
          </el-input>
        </div>
        </div>
        <el-row  style="display: flex;flex-flow: wrap">

            <div class="grid-content1" style="margin-right: 20px"><h3>8. 是否按照《工伤保险条例》参加工伤保险？</h3></div>

            <el-radio-group v-model="formData.isII">
              <el-radio
                v-for="dict in statusOptions1"
                :key="dict.dictValue"
                :label="dict.dictValue"
              >{{ dict.dictLabel }}
              </el-radio>
            </el-radio-group>

        </el-row>
        <div v-if="formData.isII=='1'">
        <el-row>
          <el-col :span="7">
            <div class="grid-content">如果是，过去三年被保险人参加工伤保险的情况:</div>
          </el-col>
          <el-col :span="4">
            <div>
              保险期间
            </div>
          </el-col>
          <el-col :span="4">
            <div>
              保险人数
            </div>
          </el-col>
          <el-col :span="4">
            <div>
              损失情况
            </div>
          </el-col>
          <el-col :span="4">
            <div>
              获赔情况
            </div>
          </el-col>
        </el-row>
        <div style="margin: 0 20px 20px 40px">
          <el-input
            style="width: 700px"
            class="input1"
            type="textarea"
            :rows="5"
            placeholder="请输入内容"
            v-model="formData.iiDesc">
          </el-input>
        </div>
        </div>
        <el-row style="display: flex;flex-flow: wrap">
            <div class="grid-content1" style="margin-right: 20px"><h3>9. 工作人员上岗前，是否经过岗位培训？</h3></div>
            <el-radio-group v-model="formData.isTrain">
              <el-radio
                v-for="dict in statusOptions1"
                :key="dict.dictValue"
                :label="dict.dictValue"
              >{{ dict.dictLabel }}
              </el-radio>
            </el-radio-group>
        </el-row>

        <el-row style="display: flex;flex-flow: wrap" v-if="formData.isTrain=='1'">
            <div class="grid-content"> 培训时间一般多长？</div>
            <el-input
              placeholder="请输入培训时间"
              v-model="formData.trainingTime"
              clearable
              style="width: 250px;margin-left: 20px"
            >
            </el-input>
        </el-row>
        <el-row style="display: flex;flex-flow: wrap">

            <div class="grid-content1" style="margin-right: 20px"><h3>10. 是否拥有专职医疗人员？</h3></div>
            <el-radio-group v-model="formData.isHaveMedicalStaff">
              <el-radio
                v-for="dict in statusOptions2"
                :key="dict.dictValue"
                :label="dict.dictValue"
              >{{ dict.dictLabel }}
              </el-radio>
            </el-radio-group>
        </el-row>
        <el-row style="display: flex;flex-flow: wrap" v-if="formData.isHaveMedicalStaff=='1'">

            <div class="grid-content"> 如果有，请列明数量:</div>

            <el-input
              placeholder="请输入数量"
              v-model="formData.medicalStaffCount"
              clearable  style="width: 250px">
            </el-input>

        </el-row>
        <el-row style="display: flex;flex-flow: wrap">

            <div class="grid-content1" style="margin-right: 20px"><h3>11.与最近的医院的距离:</h3></div>
            <el-input
              placeholder="请输入距离"
              v-model="formData.hospitalDistance"
              clearable  style="width: 250px">
            </el-input>
          <div class="grid-content" style="margin: 0 20px">请提供医院名称:</div>
          <el-input
              placeholder="请输入医院名称"
              v-model="formData.hospitalName"
              clearable style="width: 250px">
          </el-input>
        </el-row>

        <el-row style="display: flex;flex-flow: wrap">

            <div class="grid-content1" style="margin-right: 20px"><h3>12.是否全部工作人员参加医疗保险？</h3></div>

            <el-radio-group v-model="formData.isJoinMi">
              <el-radio
                v-for="dict in statusOptions1"
                :key="dict.dictValue"
                :label="dict.dictValue"
              >{{ dict.dictLabel }}
              </el-radio>
            </el-radio-group>

        </el-row>
        <el-row v-if="formData.isJoinMi=='1'">
          <el-col :span="24">
            <div class="grid-content" style="display: flex;flex-direction: column">
              <span>如果否，请说明情:</span>
              <el-input
                style="margin-top: 20px;width: 700px"
                type="textarea"
                :rows="5"
                placeholder="请输入说明情况"
                v-model="formData.descriptionMi"
                clearable>
              </el-input>
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content1" style="padding-right: 20px">
              <h3>13. 劳动合同中对被保险人工作人员伤、残或死亡及职业性疾病等规定的赔偿原则及限额:</h3>
              <el-input
                style="margin-top: 20px;margin-left: 20px;width: 700px"
                type="textarea"
                :rows="5"
                placeholder="请输入赔偿原则以及限额"
                v-model="formData.compPrincipleAndLimit"
                clearable>
              </el-input>
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content bg-purple">经保险人要求，被保险人应将与工作人员签订的劳动合同复印件交由保险人存档。</div>
          </el-col>

        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content1" style="padding-right: 20px">
              <h3>14.其他需要特别说明的情况:</h3>
              <el-input
                style="margin-top: 20px;margin-left: 20px;width: 700px"
                type="textarea"
                :rows="5"
                placeholder="请输入赔偿原则以及限额"
                v-model="formData.otherDescription"
                clearable>
              </el-input>
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content2">以下为投保信息</div>
          </el-col>
        </el-row>
        <el-row style="display: flex;flex-flow: wrap">
            <div class="grid-content1"><h3>15.</h3></div>
<!--            <el-form-item label="产品方案" prop="productDataId" style="margin-top: 20px">-->
<!--              &lt;!&ndash;             &ndash;&gt;-->
<!--              &lt;!&ndash;              <div style="width: 210px;height:40px;line-height: 40px;border: 1px solid #d9d9d9;border-radius: 6px;color: #d9d9d9;padding-left: 5px " v-if="productOptions.length==0" @click="handleChanges">请添加用工单位</div>&ndash;&gt;-->
<!--              <el-cascader  :options="productOptions" v-model="formData.productDataId"  placeholder="请选择产品方案"  @change="handleChange"  :props="props"></el-cascader>-->
<!--            </el-form-item>-->
        </el-row>
        <div >
          <div style="margin-bottom: 40px" v-for="(item,index) in ProductPlan">
            <div style="margin: 10px 20px;font-weight: bold">{{ item.name }}</div>
            <el-row style="display: flex;flex-flow: wrap">
              <div class="grid-content" style="font-weight: bold;margin-right: 20px;width: 320px;">( 1 ) 每人伤亡责任限额（小写）
              </div>
              <el-input
                  placeholder="请输入伤亡责任限额（小写）"
                  v-model="item.casualties"
                  @input="perProfit" readonly style="width: 250px">
              </el-input>
              <div style="margin-left: 10px">元</div>
              <div class="grid-content" style="font-weight: bold;margin:0 20px ">（大写）</div>
              <el-input
                  placeholder="显示伤亡责任限额（大写）"
                  v-model="item.casualties_s"
                  clearable readonly
                  style="width: 250px"
              >
              </el-input>
            </el-row>
            <el-row style="display: flex;flex-flow: wrap">
              <div class="grid-content" style="font-weight: bold;margin-right: 20px;width: 320px;">( 2 ) 每人医疗费用责任限额（小写）
              </div>
              <el-input
                  placeholder="请输入医疗费用责任限额（小写）"
                  v-model="item.medical"
                  @input="perProfit1" readonly style="width: 250px">
              </el-input>
              <div style="margin-left: 10px">元</div>
              <div class="grid-content" style="font-weight: bold;margin:0 20px">（大写）</div>
              <el-input
                  placeholder="显示医疗费用责任限额（大写）"
                  v-model="item.medical_s"
                  readonly style="width: 250px">
              </el-input>
            </el-row>

            <el-row style="display: flex;flex-flow: wrap">

              <div class="grid-content" style="font-weight: bold;margin-right: 20px;width: 320px;">( 3 )累计责任限额（小写）</div>

              <el-input
                  placeholder="请输入累计责任限额（小写）"
                  v-model="item.liability"
                  @input="perProfit3" readonly style="width: 250px">
              </el-input>
              <div style="margin-left: 10px">元</div>
              <div class="grid-content" style="font-weight: bold;margin: 0 20px">（大写）</div>
              <el-input
                  placeholder="显示累计责任限额（大写）"
                  v-model="item.liability_s"
                  readonly style="width: 250px">
              </el-input>
            </el-row>
            <el-row style="display: flex;flex-flow: wrap">

              <div class="grid-content" style="font-weight: bold;margin-right: 20px;width: 320px;">( 4 )
                每次事故每人医疗费用免赔额（小写）
              </div>

              <el-input
                  placeholder="请输入医疗费用免赔额（小写）"
                  v-model="item.deductibles"
                  @input="perProfit4" readonly style="width: 250px">
              </el-input>

              <div style="margin-left: 10px">元</div>

              <div class="grid-content" style="font-weight: bold;margin: 0 20px">（大写）</div>

              <el-input
                  placeholder="显示医疗费用免赔额（大写）"
                  v-model="item.deductibles_s"
                  readonly style="width: 250px">
              </el-input>

            </el-row>
            <el-row style="display: flex;flex-flow: wrap">
              <div class="grid-content" style="font-weight: bold;margin-right: 20px">(5) 保险费率</div>
              <el-input
                  placeholder="请输入保险费率"
                  v-model="item.insurance_rate"
                  readonly
                  style="width: 250px"
              >
              </el-input>
              <div class="grid-content"> ‰</div>

            </el-row>
            <el-row style="display: flex;flex-flow: wrap">
              <div class="grid-content" style="font-weight: bold;margin-right: 20px">(6) 误工费限额</div>
              <div>100元/天 , 免赔三天</div>
            </el-row>
            <el-row style="display: flex;flex-flow: wrap">
              <div class="grid-content" style="font-weight: bold;margin-right: 20px">(7) 住院津贴限额:</div>
              <div>60元/天 , 免赔三天</div>
            </el-row>
          </div>
          <div style="font-weight: bold;margin-left: 40px">注: 可根据工作人员类型确定差别责任限额。</div>
        </div>
        <el-row>
            <div class="grid-content1" style="margin-right: 20px"><h3>16.保险期间</h3></div>
          <div style="display: flex;align-items: center;flex-flow: wrap;">

       <span style="margin-right: 10px;">
             <el-form-item  label="起始日期" prop="insuranceTimeStart" style="margin-bottom: 1px">
           <el-date-picker
               ref="insuranceTimeStart"
               v-model="formData.insuranceTimeStart"
               type="date"
               placeholder="请选择起始日期"
               format="yyyy 年 MM 月 dd 日"
               value-format="yyyy-MM-dd">
        </el-date-picker>
          </el-form-item>
        </span> 零时起
            <span style="margin: 0 10px">
         <el-form-item  label="结束日期" prop="insuranceTimeEnd" style="margin-bottom: 1px">
          <el-date-picker
              ref="insuranceTimeEnd"
              v-model="formData.insuranceTimeEnd"
              type="date"
              placeholder="请选择结束日期"  format="yyyy 年 MM 月 dd 日"
              value-format="yyyy-MM-dd">

            </el-date-picker>
           </el-form-item>
       </span> 二十四时止
          </div>
        </el-row>
        <el-row style="display: flex;flex-flow: wrap">
            <div class="grid-content1" style="display: flex;align-items: center;margin-right: 20px"><h3 >17. 总保险费</h3>（小写）</div>
            <el-input
              placeholder="请输入总保险费（小写）"
              v-model="formData.sinsuranceFeeCount"
              @input="perProfit5" readonly style="width: 250px">
            </el-input>
            <div style="margin-left: 10px">元</div>
            <div class="grid-content">（大写）</div>
            <el-input
              placeholder="显示总保险费（大写）"
              v-model="formData.sinsuranceFeeCounts"
              readonly style="width: 250px">
            </el-input>
        </el-row>
        <el-row style="display: flex;flex-flow: wrap">
            <div class="grid-content1" style="margin-right: 20px"><h3>18. 保险费支付日期:</h3></div>
            <el-date-picker
              v-model="formData.payTime"
              type="date"
              placeholder="请选择支付日期"
              format="yyyy 年 MM 月 dd 日"
              value-format="yyyy-MM-dd"
              >
            </el-date-picker>
        </el-row>
        <el-row style="display: flex;flex-flow: wrap">
            <div class="grid-content1" style="margin-right: 20px"><h3>19. 保险合同争议解决方式选择:</h3></div>
            <el-radio-group v-model="formData.solution">
              <el-radio
                v-for="dict in statusOptions3"
                :key="dict.dictValue"
                :label="dict.dictValue"
              >{{ dict.dictLabel }}
              </el-radio>
            </el-radio-group>
        </el-row>
        <!--        特别约定1-->
        <div >
          <div class="conter" >
            <el-row>
              <el-col :span="2">
                <h3>20.特别约定</h3>
              </el-col>
            </el-row>
            <div v-for="(item,index) in ProductPlan" :key="index">

              <div style="margin-bottom: 50px">
                <div style="font-weight: bold;margin-left: 20px;margin-bottom: 20px">{{ item.name }}</div>
                <div style="margin-left: 20px;">
                  {{item.specifically_agreed}}
                </div>
              </div>
            </div>
          </div>


          <el-row>
            <el-col :span="24">
              <div class="grid-content ">
                <span style="font-weight: bold;margin-left: 30px">投保人声明:</span>
                保险人已将《雇主责任保险条款》（包括责任免除部分）向本人做了明确说明，本人已充分理解；上述所填写的内容均属实，同意以此投保单及附件作为订立保险合同的依据。
              </div>
            </el-col>
          </el-row>
          <el-row>

            <el-col :span="19">
              <div class="grid-content " style="text-align: right ;margin-right: 5px">
                投保人（签章）:
              </div>
            </el-col>
            <el-col :span="4">
              <div  >
                <el-image
                    v-if="formData.seal!=''"
                    style="width:100px; height: 100px"
                    :src="url+formData.seal"
                    :preview-src-list="[url+formData.seal]">
                </el-image>

                <!--                <el-upload-->
                <!--                  class="upload-demo"-->
                <!--                  action-->
                <!--                  :http-request="handleUpdateForm"-->
                <!--                  :before-upload="beforeUploadForm"-->
                <!--                  :auto-upload="true"-->
                <!--                  :show-file-list="false"-->
                <!--                  >-->
                <!--                  <el-button type="primary" v-if="show1">点击上传</el-button>-->
                <!--                  <div v-else style="width: 160px;height: 50px;line-height: 50px" >-->
                <!--                    <img :src="urlImage1" width="100" height="100px">-->
                <!--                  </div>-->
                <!--                </el-upload>-->

              </div>

            </el-col>
          </el-row>
          <el-row>

            <el-col :span="19">
              <div class="grid-content " style="text-align: right ;margin-right: 5px">
                日期:
              </div>
            </el-col>
            <el-col :span="5">
              <el-date-picker
                  v-model="formData.signingTime"
                  type="date"
                  placeholder="选择日期"
                  format="yyyy 年 MM 月 dd 日"
                  value-format="yyyy-MM-dd">
              </el-date-picker>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="2">
              <div class="grid-content ">
                承保性质:
              </div>
            </el-col>
            <el-col :span="13">
              <el-radio-group v-model="formData.underwriting">
                <el-radio
                    v-for="dict in statusOptions4"
                    :key="dict.dictValue"
                    :label="dict.dictValue"
                >{{ dict.dictLabel }}
                </el-radio>
              </el-radio-group>

            </el-col>
            <el-col :span="4">
              <div class="grid-content " style="text-align: right;">
                业务员/代理人姓名：
              </div>
            </el-col>
            <el-col :span="4">
              <el-input style="width: 220px" v-model="formData.agent" placeholder="请输入业务员/代理人姓名"></el-input>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="2">
              <div class="grid-content ">
                公司网址
              </div>
            </el-col>
            <el-col :span="6">
              <a style="color: dodgerblue">www.chinalife-p.com.cn</a>
            </el-col>
            <el-col :span="4">
              <div> 服务电话：95519</div>
            </el-col>

          </el-row>
          <div>
            <el-row>
              <el-col :span="24">
                <div class="grid-content " style="text-align: center">
                  <img src="../../../assets/images/Application.png" height="88" width="690"/></div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <h2 class="grid-content " style="text-align: center">
                  免责条款特别提示
                </h2>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <div>尊敬的客户：</div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <div class="grid-content" style="margin-left: 60px">非常感谢您向我们投保 <span
                    style="font-weight: bold;text-decoration:underline">雇主责任保险</span>，请仔细阅读保险条款，特别是以下责任免除条款，我们现向您作明确说明，请您认真听取并予以足够的重视：
                </div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <div class="grid-content" style="font-weight: bold">下列原因造成的损失、费用和责任，保险人不负责赔偿:</div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <div class="grid-content" style="font-weight: bold">（一）投保人、被保险人及其代表的故意行为;</div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <div class="grid-content" style="font-weight: bold">（二）战争、敌对行动、军事行为、武装冲突、罢工、骚乱、暴动、恐怖活动;</div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <div class="grid-content" style="font-weight: bold">（三）核辐射、核爆炸、核污染及其他放射性污染;</div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <div class="grid-content" style="font-weight: bold">（四）大气污染、土地污染、水污染及其他各种污染;</div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <div class="grid-content" style="font-weight: bold">（五）行政行为或司法行为;</div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <div class="grid-content" style="font-weight: bold">（六）被保险人的工作人员犯罪或者违反法律、法规的;</div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <div class="grid-content" style="font-weight: bold">（七）被保险人的工作人员醉酒导致伤亡的;</div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <div class="grid-content" style="font-weight: bold">（八）被保险人的工作人员自残或者自杀的;</div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <div class="grid-content" style="font-weight: bold">
                  （九）在工作时间和工作岗位，被保险人的工作人员因投保时已患有的疾病发作或分娩、流产导致死亡或者在48小时之内经抢救无效死亡。
                </div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <div class="grid-content" style="font-weight: bold">下列损失、费用和责任，保险人不负责赔偿:</div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <div class="grid-content" style="font-weight: bold">（一）被保险人的承包商工作人员的人身伤亡;</div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <div class="grid-content" style="font-weight: bold">（二）被保险人应该承担的合同责任，但无合同存在时仍然应由被保险人承担的经济赔偿责任不在此限;</div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <div class="grid-content" style="font-weight: bold">（三）罚款、罚金及惩罚性赔款;</div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <div class="grid-content" style="font-weight: bold">（四）精神损害赔偿;</div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <div class="grid-content" style="font-weight: bold">（五）间接损失;</div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <div class="grid-content" style="font-weight: bold">（六）被保险人的工作人员因保险合同列明情形之外原因发生的医疗费用;</div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <div class="grid-content" style="font-weight: bold">（七）本保险合同中载明的免赔额。</div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <div class="grid-content" style="font-weight: bold">其他不属于本保险责任范围内的损失、费用和责任，保险人不负责赔偿。</div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <div style="text-align: center"> <h3>中国人寿财产保险股份有限公司宁波市分公司</h3></div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <div class="grid-content" style="font-weight: bold"> 投保人声明：</div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <div class="grid-content" style="text-indent: 2em">
                  本人已收到并仔细阅读了贵公司提供的全部投保的保险条款。本人确认：贵公司已依法对保险合同的内容向本人作出说明；特别是保险合同中的免除保险人责任的条款，贵公司已依法向本人作出明确说明，并向本人进行了多次的提示，本人对保险条款中的保险责任、免除保险人责任的条款的概念、内容及法律后果均已充分理解并明了。特此声明！
                </div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="19">
                <div class="grid-content" style="text-align: right;margin-right: 10px"> 投保人签章/签名:</div>
              </el-col>
              <el-col :span="4">
                <div >
                  <el-image
                      v-if="formData.signPolicyholder!=''"
                      style="width:100px; height: 100px"
                      :src="url+formData.signPolicyholder"
                      :preview-src-list="[url+formData.signPolicyholder]">
                  </el-image>

                  <!--                  <el-upload-->
                  <!--                    class="upload-demo"-->
                  <!--                    action-->
                  <!--                    :http-request="handleUpdateForm1"-->
                  <!--                    :before-upload="beforeUploadForm1"-->
                  <!--                    :auto-upload="true"-->
                  <!--                    :show-file-list="false"-->
                  <!--                  >-->
                  <!--                    <el-button type="primary" v-if="show">点击上传</el-button>-->
                  <!--                    <div v-else style="width: 160px;height: 50px;line-height: 50px" >-->
                  <!--                      <img :src="urlImage" width="100" height="100px">-->
                  <!--                    </div>-->
                  <!--                  </el-upload>-->
                </div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="19">
                <div class="grid-content" style="text-align: right;margin-right: 10px"> 日期:</div>
              </el-col>
              <el-col :span="4">
                <el-date-picker
                    v-model="formData.signPolicyholderTime"
                    type="date"
                    placeholder="选择日期"
                    format="yyyy 年 MM 月 dd 日"
                    value-format="yyyy-MM-dd"
                >
                </el-date-picker>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <div style="text-align: right">
                  <!--                  <el-button type="primary" style="width: 150px" @click="resetForm('formData')">重置</el-button>-->
                  <el-button type="primary" style="width: 150px" @click="getAdd('formData')">下一步</el-button>
                </div>
              </el-col>
            </el-row>
          </div>
        </div>
      </el-form>
    </div>
    <div class="footer"  >
      <el-button type="primary" v-show="gotop" icon="el-icon-top" circle @click="toTop"></el-button>
    </div>
  </div>
</template>
<script>
import {listTemplate, uploadTmage} from '@/api/base/template'
import {dataURLtoFile} from '@/utils/env'
import {updateInsureEli,updateInsureEli1,getInsureEli1} from '@/api/insurance/insureEli'
import {listEmployer} from "@/api/insurance/employer";
import {listProductType} from "@/api/insurance/productType";
import log from "../../monitor/job/log";


export default {
  name: "add",
  data() {
    return {
      gotop:false,//回到顶部显示不显示
      url:process.env.VUE_APP_BASE_API,//地址
      id:'',
      isActive:0,
      //投保人签字展示显示隐藏
      show: true,
      show1: true,
      isCrop: false,
      templateName:[],//投保类型
      //投保性质
      statusOptions:[],
      statusOptions1:[],//7. 过去三年是否投保过与雇主责任相关的保险？
      statusOptions2:[],//7.  //过去三年损失情况如何
      statusOptions3:[],//保险合同争议解决方式选择
      statusOptions4:[],//投保性质
      //遮罩层显示隐藏
      outerVisible: false,
      lineColor: '#000000',
      bgColor: '',
      lineWidth: 6,
      isCrop1: false,
      //遮罩层显示隐藏
      outerVisible1: false,
      lineColor1: '#000000',
      bgColor1: '',
      lineWidth1: 6,
      options: [],
      //展示投保人签章签名
      urlImage: '',
      //展示投保人（签章）
      urlImage1: '',

      value1: '',
      //投保选择
      list: [],
      formData: {
        insure_id:'',//保单id
        user_id:'',//操作人id
        employerId1: '',//投保用工单位id
        employerId2: '',//被投保用工单位
        name1: '', //  投保人姓名
        contactPerson1: '',//投保人联系人姓名
        phone1: '',  // 投保人联系电话
        mailAddress1: '', //投保人通讯地址
        emailCode1: '',//投保人邮编
        email1: '', //  投保人电子邮箱
        name2: '', //被投保人名称
        contactPerson2: '',//被投保人联系姓名
        phone2: '', //  被投保联系方式
        mailAddress2: '', //投保人通讯地址
        emailCode2: '',//投保人邮编
        email2: '',//  被投保电子邮箱
        nature2: '', //  3被投保人性质
        industry: '',  //  所在行业
        address2: '',  //  被保险人地址/营业场所
        businessScope2: '',  // 被保险人营业范围
        staffCount2: '',  // 被保险人工作人员总人数
        seniorDescription: '', //   其中高级职员姓名，职务，健康情况，请说明：
        generalDescription: '', // 其他类型工作人员说明（如工作类型、人数、健康情况）
        // 7. 过去三年是否投保过与雇主责任相关的保险？ {{isELI1}}是     {{isELI0}}否
        isELI: '1',//是
        //过去三年损失情况如何  {{isLossEli1}}有    {{isLossEli0}}无
        isLossEli: '1',//有
        // 如果有，请说明：保险期间        保险人数                损失情况                获赔情况
        eliDesc: '',
        // 是否按照《工伤保险条例》参加工伤保险？    {{isII1}}是    {{isII0}}否
        isII: '0',//是
        // 如果是，过去三年被保险人参加工伤保险的情况：保险期间  保险人数  损失情况  获赔情况
        iiDesc: '',
        // 工作人员上岗前，是否经过岗位培训？    {{isTrain1}}是    {{isTrain0}}否
        isTrain: '1',//是
        trainingTime: '',    // 培训时间一般多长？
        // 是否拥有专职医疗人员？  {{isHaveMedicalStaff1}}有 {{isHaveMedicalStaff0}}无
        isHaveMedicalStaff: '0',//有
        medicalStaffCount: '', // 如果有，请列明数量
        hospitalDistance: '',    //      与最近的医院的距离
        hospitalName: '', //请提供医院名称
        // 是否全部工作人员参加医疗保险？       {{isJoinMi1}}是   {{isJoinMi0}}否
        isJoinMi: '0',
        descriptionMi: '',// 如果否，请说明情况：
        compPrincipleAndLimit: '', //13. 赔偿原则及限额
        otherDescription: '', //其他需要特别说明的情况
        insuranceTimeStart: '', // 16.保险期间：零时起
        insuranceTimeEnd: '',//二十四时止。
        sinsuranceFeeCounts: '',//17.总保险费（大写）
        sinsuranceFeeCount: '',//小写
        payTime: '',//18.保险费支付日期：
        solution: '1',//19.保险合同争议解决方式选择
        seal: '',//  投保人（签章）
        signingTime: '',//签章日期
        underwriting: '1',//承保性质
        agent: '',// 业务员/代理人姓名
        signPolicyholder: '',//   投保人（签章）
        signPolicyholderTime: '',//投保人（签章）日期
      },
      insuranceTimeStart:'',// 16.保险期间：零时起
      insuranceTimeEnd:'',//二十四时止。
      payTime:'',////18.保险费支付日期：
      signingTime:'',//签章日期
      signPolicyholderTime:'',//投保人（签章）日期
      rules: {
        // employer1:{
          name1: [
            {required: true, message: '请输入投保人姓名', trigger: 'blur'}
          ],
          contactPerson1: [
            {required: true, message: '请输入联系人姓名', trigger: 'blur'}
          ],
          phone1: [
            {required: true, message: '请输入联系人电话', trigger: 'blur'},
            {pattern: /^1[3|4|5|7|8][0-9]{9}$/, message: '请输入正确的联系人电话'}

          ],
        mailAddress1:[
          {required:true, message: '请输入投保人通讯地址', trigger: 'blur'},
          // {validator:validate('netmask','请输入正确的投保人通讯地址')}
        ],
        emailCode1:[
          {required:true, message: '请输入投保人邮编', trigger: 'blur'},
        ],
          email1: [
            {required: false, message: '请输入邮箱地址', trigger: 'blur'},
            {type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change']}
          ],
        // },
        // employer2:{
          name2: [
            {required: true, message: '请输入被投保人姓名', trigger: 'blur'}
          ],
          contactPerson2: [
            {required: true, message: '请输入联系人姓名', trigger: 'blur'}
          ],
          phone2: [
            {required: true, message: '请输入联系人电话', trigger: 'blur'},
            {pattern: /^1[3|4|5|7|8][0-9]{9}$/, message: '请输入正确的联系人电话'}
          ],
        mailAddress2:[
          {required:true, message: '请输入被保险人通讯地址', trigger: 'blur'},
          // {validator:validate('netmask','请输入正确的投保人通讯地址')}
        ],
        emailCode2:[
          {required:true, message: '请输入被保险人邮编', trigger: 'blur'},
        ],
          email2: [
            {required: false, message: '请输入邮箱地址', trigger: 'blur'},
            {type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change']}
          ],
        // },

        employerId1:[
          { required: false, message: '请选择用工单位', trigger: 'change'}
        ],
        productDataId:[
          { required: false, message: '请选择产品方案', trigger: 'change'}
        ]
      },
      unit: new Array("仟", "佰", "拾", "", "仟", "佰", "拾", "", "角", "分"),
      Employer:[],//获取用工单位数据
      queryParams1: {
        pageNum: 1,
        pageSize: 10,
        synopsis: null,
        type: null,
        status: null
      },
      //产品方案
      productOptions:[],
      props:{
        value:'id',
        label:'name',
        children:'datas'
      },
      //字典回显
      typeOptions1:[],
      insure_id:'',//保单id
      ProductPlan:[],//方案
    }
  },
  mounted() {
    // 此处true需要加上，不加滚动事件可能绑定不成功
    window.addEventListener("scroll", this.handleScroll, true);
  },
  methods: {
    //返回上一页
    getBack(){
      this.$router.back(-1);
    },
    handleScroll() {
      let scrolltop = document.documentElement.scrollTop || document.body.scrollTop;
      // console.log('scrolltop',scrolltop)
      scrolltop > 30 ? (this.gotop = true) : (this.gotop = false);
    },
    //通过点击滚动回到顶部
    toTop() {
      let top = document.documentElement.scrollTop || document.body.scrollTop;
      // 实现滚动效果
      const timeTop = setInterval(() => {
        document.body.scrollTop = document.documentElement.scrollTop = top -= 50;
        if (top <= 0) {
          clearInterval(timeTop);
        }
      }, 10);
    },
    //搜索用工单位
    getSelectEmployer(){
      listEmployer().then(res=>{
       for (var i=0;i<res.rows.length;i++){
         if (res.rows[i].type==2){
           this.Employer.push(res.rows[i])
         }
       }
        // console.log('res',res)
      })
    },
    getDate(e){
      // console.log('e',e);
      //转换为时间戳
      var date=e.getTime(e);
     this.formData.insuranceTimeStart=date
      // console.log('b',b);
    },
    //选择用工单位
    getEmployer(item){
      this.formData.name1=item.name;
      this.formData.contactPerson2=item.contact;
      this.formData.phone2=item.phone;
      this.formData.email2=item.email;
      this.formData.nature2=item.nature;
      this.formData.industry=item.industry;
      this.formData.address2=item.address;
      this.formData.businessScope2=item.businessScope;
      this.formData.staffCount2=item.staffCount;
      this.formData.seniorDescription=item.seniorDescription;
      this.formData.generalDescription=item.generalDescription;
      this.formData.mailAddress2=item.mailAddress;
      this.formData.emailCode2=item.emailCode;
      // console.log('formData',this.formData);
      // console.log('item',item);
    },
    //产品方案选择
    handleChange(value){
      // console.log('产品方案',value)
      this.formData.productDataId=value[1]
      var id=value;
      // this.proShow=true;
      listProductType(this.queryParams1).then(response=> {
        var datas={}
        for (var i = 0; i < response.rows.length; i++) {
          for (var j = 0; j < response.rows[i].datas.length; j++) {
            if (response.rows[i].id == id[0] && response.rows[i].datas[j].id == id[1]) {
              datas=response.rows[i].datas[j];
            }
          }
        }
        this.formData.casualtiesFeeLimit=datas.casualties
        this.formData.medicalFeeLimit=datas.medical;
        this.formData.legalFeeLimit=datas.legal;
        this.formData.liabilityLimit=datas.liability;
        this.formData.deductible=datas.deductibles;
        this.formData.insuranceRate=datas.insuranceRate
        // console.log('objdatas',datas);
        if (this.formData.casualtiesFeeLimit!=null){
          this.perProfits();
        }
        if (this.formData.medicalFeeLimit!=null){
          this.perProfits1();
        }
        if (this.formData.legalFeeLimit!=null){
          this.perProfits2();
        }
        if ( this.formData.liabilityLimit!=null){
          this.perProfits3();
        }
        if (this.formData.deductible!=null){
          this.perProfits4()
        }
      })

    },
    perProfits() {

      //输入金额时，限制小数后两位正则表达式
      var that = this;

      if (!this.formData.casualtiesFeeLimit) {
        this.$Message.error('请输入正确的投资金额');
        this.formData.casualtiesFeeLimit = '';
        return
      }
      if (this.formData.casualtiesFeeLimit !== '') {

        var m = this.formData.casualtiesFeeLimit
        m *= 100;
        m += "";
        // console.log('m', m)
        var length = m.length;
        var result = "";
        for (var i = 0; i < length; i++) {
          if (i == 2) {
            result = "元" + result;
          } else if (i == 6) {
            result = "万" + result;
          }
          if (m.charAt(length - i - 1) == 0) {
            if (i != 0 && i != 1) {
              if (result.charAt(0) != '零' && result.charAt(0) != '元' && result.charAt(0) != '万') {
                result = "零" + result;
              }
            }
            continue;
          }
          result = this.toDx(m.charAt(length - i - 1)) + this.unit[this.unit.length - i - 1] + result;
        }
        result += result.charAt(result.length - 1) == '元' ? "整" : "";
        this.formData.casualtiesFeeLimits = result;
        if (this.formData.casualtiesFeeLimit < 1
        ) {
          this.$Message.error('投资金额必须大于1元');
          return
        }
        // if (this.formData.casualtiesFeeLimit > this.table.remainMoney) {
        //   this.$Message.error('不能超过可投金额');
        //   this.formData.casualtiesFeeLimit = '';
        //   return
        // }
      }
    },
    perProfits1() {
      if (!this.formData.medicalFeeLimit) {
        this.$Message.error('请输入正确的投资金额');
        this.formData.medicalFeeLimit = '';
        return
      }
      if (this.formData.medicalFeeLimit !== '') {

        var m = this.formData.medicalFeeLimit
        m *= 100;
        m += "";
        // console.log('m', m)
        var length = m.length;
        var result = "";
        for (var i = 0; i < length; i++) {
          if (i == 2) {
            result = "元" + result;
          } else if (i == 6) {
            result = "万" + result;
          }
          if (m.charAt(length - i - 1) == 0) {
            if (i != 0 && i != 1) {
              if (result.charAt(0) != '零' && result.charAt(0) != '元' && result.charAt(0) != '万') {
                result = "零" + result;
              }
            }
            continue;
          }
          result = this.toDx(m.charAt(length - i - 1)) + this.unit[this.unit.length - i - 1] + result;
        }
        result += result.charAt(result.length - 1) == '元' ? "整" : "";
        this.formData.medicalFeeLimits = result;
        if (this.formData.medicalFeeLimit < 1
        ) {
          this.$Message.error('投资金额必须大于1元');
          return
        }
        // if (this.formData.casualtiesFeeLimit > this.table.remainMoney) {
        //   this.$Message.error('不能超过可投金额');
        //   this.formData.casualtiesFeeLimit = '';
        //   return
        // }
      }
    },
    perProfits2() {
      if (!this.formData.legalFeeLimit) {
        this.$Message.error('请输入正确的投资金额');
        this.formData.legalFeeLimit = '';
        return
      }
      if (this.formData.legalFeeLimit !== '') {

        var m = this.formData.legalFeeLimit
        m *= 100;
        m += "";
        // console.log('m', m)
        var length = m.length;
        var result = "";
        for (var i = 0; i < length; i++) {
          if (i == 2) {
            result = "元" + result;
          } else if (i == 6) {
            result = "万" + result;
          }
          if (m.charAt(length - i - 1) == 0) {
            if (i != 0 && i != 1) {
              if (result.charAt(0) != '零' && result.charAt(0) != '元' && result.charAt(0) != '万') {
                result = "零" + result;
              }
            }
            continue;
          }
          result = this.toDx(m.charAt(length - i - 1)) + this.unit[this.unit.length - i - 1] + result;
        }
        result += result.charAt(result.length - 1) == '元' ? "整" : "";
        this.formData.legalFeeLimits = result;
        if (this.formData.legalFeeLimit < 1
        ) {
          this.$Message.error('投资金额必须大于1元');
          return
        }
        // if (this.formData.casualtiesFeeLimit > this.table.remainMoney) {
        //   this.$Message.error('不能超过可投金额');
        //   this.formData.casualtiesFeeLimit = '';
        //   return
        // }
      }
    },
    perProfits3() {
      if (!this.formData.liabilityLimit) {
        this.$Message.error('请输入正确的投资金额');
        this.formData.liabilityLimit = '';
        return
      }
      if (this.formData.liabilityLimit !== '') {

        var m = this.formData.liabilityLimit
        m *= 100;
        m += "";
        // console.log('m', m)
        var length = m.length;
        var result = "";
        for (var i = 0; i < length; i++) {
          if (i == 2) {
            result = "元" + result;
          } else if (i == 6) {
            result = "万" + result;
          }
          if (m.charAt(length - i - 1) == 0) {
            if (i != 0 && i != 1) {
              if (result.charAt(0) != '零' && result.charAt(0) != '元' && result.charAt(0) != '万') {
                result = "零" + result;
              }
            }
            continue;
          }
          result = this.toDx(m.charAt(length - i - 1)) + this.unit[this.unit.length - i - 1] + result;
        }
        result += result.charAt(result.length - 1) == '元' ? "整" : "";
        this.formData.liabilityLimits = result;
        if (this.formData.liabilityLimit < 1
        ) {
          this.$Message.error('投资金额必须大于1元');
          return
        }
        // if (this.formData.casualtiesFeeLimit > this.table.remainMoney) {
        //   this.$Message.error('不能超过可投金额');
        //   this.formData.casualtiesFeeLimit = '';
        //   return
        // }
      }
    },
    perProfits4() {
      if (!this.formData.deductible) {
        this.$Message.error('请输入正确的投资金额');
        this.formData.deductible = '';
        return
      }
      if (this.formData.deductible !== '') {

        var m = this.formData.deductible
        m *= 100;
        m += "";
        // console.log('m', m)
        var length = m.length;
        var result = "";
        for (var i = 0; i < length; i++) {
          if (i == 2) {
            result = "元" + result;
          } else if (i == 6) {
            result = "万" + result;
          }
          if (m.charAt(length - i - 1) == 0) {
            if (i != 0 && i != 1) {
              if (result.charAt(0) != '零' && result.charAt(0) != '元' && result.charAt(0) != '万') {
                result = "零" + result;
              }
            }
            continue;
          }
          result = this.toDx(m.charAt(length - i - 1)) + this.unit[this.unit.length - i - 1] + result;
        }
        result += result.charAt(result.length - 1) == '元' ? "整" : "";
        this.formData.deductibles = result;
        if (this.formData.deductible < 1
        ) {
          this.$Message.error('投资金额必须大于1元');
          return
        }
        // if (this.formData.casualtiesFeeLimit > this.table.remainMoney) {
        //   this.$Message.error('不能超过可投金额');
        //   this.formData.casualtiesFeeLimit = '';
        //   return
        // }
      }
    },

    //获取产品方案
    getListProductType(){
      listProductType(this.queryParams1).then(response=>{
        console.log('产品方案',response)
        this.productOptions=[];
        this.productOptions=response.rows;
        this.productOptions.forEach(v=>{
          v.name=this.selectDictLabel(this.typeOptions1,v.type);
        })

        console.log('产品方案productOptions',this.productOptions)
      })
    },
    // getDate1(e){
    //   console.log('insuranceTimeEnd1额',e);
    //   var date1=e.getTime(e);
    //   this.formData.insuranceTimeEnd=date1;
    //   console.log('insuranceTimeEnd',this.formData.insuranceTimeEnd);
    //
    // },
    // //保险支付日期
    // getDate2(e){
    //   var date2=e.getTime(e);
    //   this.formData.payTime=date2;
    // },
    // 投保人（签章）
    // getDate3(e){
    //   var date3=e.getTime(e);
    //   this.formData.signingTime=date3;
    // },
    // //投保人（签章）日期
    // getDate4(e){
    //   var date4=e.getTime(e);
    //   this.formData.signPolicyholderTime=date4;
    // },
    // getSelect(item,index) {
    //   this.formData.templateId = item.id;
    //   this.isActive=index;
      // console.log('item',item);
      // console.log('index',index);
      // console.log('e', e)

      // console.log('templateId', this.formData.templateId)
    // },
    // //香烟则被投保人性质
    // getDate(e) {
    //   console.log('e', e)
    //   console.log('formData', this.formData);
    // },

    //选择投保单类型
    getQuer() {
      listTemplate().then(response => {
        this.options = response.rows;
        // this.formData.templateId = this.options[0].id
        // console.log('response', response)
      })
    },
    // 上传签章格式显示
    beforeUploadForm(file){
      // console.log('file12',file)
      const isPng=file.type==='image/png';
      const  isLt2M=file.size/1024/1024<2;
      if (!isPng){
        this.$message.error('上传签章只能是png格式!');

      }
      if (!isLt2M){
        this.$message.error('上传签章大小不能超过2MB!');
      }
      return isPng && isLt2M;
    },
    //上传签章
    handleUpdateForm(param) {
      // console.log('param', param)
      // console.log('isSupportUpdate',this.upload)
      let that = this;
      let formData = new FormData();
      formData.append('file', param.file);
      // console.log('param', formData);
      uploadTmage(formData).then(response => {
        this.urlImage1 = response.url;
        this.formData.seal = response.fileName;
        if (this.urlImage1!=''){
          this.show1=false;
        }else{
          this.show1=true;
        }
        // console.log('res',  this.urlImage)
        // console.log('res', response)

      })
    },
    //上传签章限制
    beforeUploadForm1(file){
      // console.log('file12',file)
      const isPng=file.type==='image/png';
      const  isLt2M=file.size/1024/1024<2;
      if (!isPng){
        this.$message.error('上传签章只能是png格式!');

      }
      if (!isLt2M){
        this.$message.error('上传签章大小不能超过2MB!');
      }
      return isPng && isLt2M;
    },
    //上传签章
    handleUpdateForm1(param) {
      // console.log('param', param)
      // console.log('isSupportUpdate',this.upload)
      let that = this;
      let formData = new FormData();
      formData.append('file', param.file);
      // console.log('param', formData);
      uploadTmage(formData).then(response => {
        this.urlImage = response.url;
        this.formData.signPolicyholder = response.fileName;
        if (this.urlImage!=''){
          this.show=false;
        }else{
          this.show=true;
        }
        // console.log('res',  this.urlImage)
        // console.log('res', response)

      })
    },

    toDx(n) {   //阿拉伯数字转换函数
      switch (n) {
        case "0":
          return "零";
        case "1":
          return "壹";
        case "2":
          return "贰";
        case "3":
          return "叁";
        case "4":
          return "肆";
        case "5":
          return "伍";
        case "6":
          return "陆";
        case "7":
          return "柒";
        case "8":
          return "捌";
        case "9":
          return "玖";
      }
    },
    perProfit(e) {
      // console.log('e', e)
      //输入金额时，限制小数后两位正则表达式
      var that = this;
      e = (e.match(/^\d*(\.?\d{0,2})/g)[0]) || null
      this.formData.casualtiesFeeLimit = e;
      if (!this.formData.casualtiesFeeLimit) {
        this.$Message.error('请输入正确的投资金额');
        this.formData.casualtiesFeeLimit = '';
        return
      }
      if (this.formData.casualtiesFeeLimit !== '') {

        var m = this.formData.casualtiesFeeLimit
        m *= 100;
        m += "";
        // console.log('m', m)
        var length = m.length;
        var result = "";
        for (var i = 0; i < length; i++) {
          if (i == 2) {
            result = "元" + result;
          } else if (i == 6) {
            result = "万" + result;
          }
          if (m.charAt(length - i - 1) == 0) {
            if (i != 0 && i != 1) {
              if (result.charAt(0) != '零' && result.charAt(0) != '元' && result.charAt(0) != '万') {
                result = "零" + result;
              }
            }
            continue;
          }
          result = this.toDx(m.charAt(length - i - 1)) + this.unit[this.unit.length - i - 1] + result;
        }
        result += result.charAt(result.length - 1) == '元' ? "整" : "";
        this.formData.casualtiesFeeLimits = result;
        if (this.formData.casualtiesFeeLimit < 1
        ) {
          this.$Message.error('投资金额必须大于1元');
          return
        }
        // if (this.formData.casualtiesFeeLimit > this.table.remainMoney) {
        //   this.$Message.error('不能超过可投金额');
        //   this.formData.casualtiesFeeLimit = '';
        //   return
        // }
      }
    },
    perProfit1(e) {
      // console.log('e', e)
      //输入金额时，限制小数后两位正则表达式
      var that = this;
      e = (e.match(/^\d*(\.?\d{0,2})/g)[0]) || null
      this.formData.medicalFeeLimit = e;
      if (!this.formData.medicalFeeLimit) {
        this.$Message.error('请输入正确的投资金额');
        this.formData.medicalFeeLimit = '';
        return
      }
      if (this.formData.medicalFeeLimit !== '') {

        var m = this.formData.medicalFeeLimit
        m *= 100;
        m += "";
        // console.log('m', m)
        var length = m.length;
        var result = "";
        for (var i = 0; i < length; i++) {
          if (i == 2) {
            result = "元" + result;
          } else if (i == 6) {
            result = "万" + result;
          }
          if (m.charAt(length - i - 1) == 0) {
            if (i != 0 && i != 1) {
              if (result.charAt(0) != '零' && result.charAt(0) != '元' && result.charAt(0) != '万') {
                result = "零" + result;
              }
            }
            continue;
          }
          result = this.toDx(m.charAt(length - i - 1)) + this.unit[this.unit.length - i - 1] + result;
        }
        result += result.charAt(result.length - 1) == '元' ? "整" : "";
        this.formData.medicalFeeLimits = result;
        if (this.formData.medicalFeeLimit < 1
        ) {
          this.$Message.error('投资金额必须大于1元');
          return
        }
        // if (this.formData.casualtiesFeeLimit > this.table.remainMoney) {
        //   this.$Message.error('不能超过可投金额');
        //   this.formData.casualtiesFeeLimit = '';
        //   return
        // }
      }
    },
    perProfit2(e) {
      // console.log('e', e)
      //输入金额时，限制小数后两位正则表达式
      var that = this;
      e = (e.match(/^\d*(\.?\d{0,2})/g)[0]) || null
      this.formData.legalFeeLimit = e;
      if (!this.formData.legalFeeLimit) {
        this.$Message.error('请输入正确的投资金额');
        this.formData.legalFeeLimit = '';
        return
      }
      if (this.formData.legalFeeLimit !== '') {

        var m = this.formData.legalFeeLimit
        m *= 100;
        m += "";
        // console.log('m', m)
        var length = m.length;
        var result = "";
        for (var i = 0; i < length; i++) {
          if (i == 2) {
            result = "元" + result;
          } else if (i == 6) {
            result = "万" + result;
          }
          if (m.charAt(length - i - 1) == 0) {
            if (i != 0 && i != 1) {
              if (result.charAt(0) != '零' && result.charAt(0) != '元' && result.charAt(0) != '万') {
                result = "零" + result;
              }
            }
            continue;
          }
          result = this.toDx(m.charAt(length - i - 1)) + this.unit[this.unit.length - i - 1] + result;
        }
        result += result.charAt(result.length - 1) == '元' ? "整" : "";
        this.formData.legalFeeLimits = result;
        if (this.formData.legalFeeLimit < 1
        ) {
          this.$Message.error('投资金额必须大于1元');
          return
        }
        // if (this.formData.casualtiesFeeLimit > this.table.remainMoney) {
        //   this.$Message.error('不能超过可投金额');
        //   this.formData.casualtiesFeeLimit = '';
        //   return
        // }
      }
    },
    perProfit3(e) {
      // console.log('e', e)
      //输入金额时，限制小数后两位正则表达式
      var that = this;
      e = (e.match(/^\d*(\.?\d{0,2})/g)[0]) || null
      this.formData.liabilityLimit = e;
      if (!this.formData.liabilityLimit) {
        this.$Message.error('请输入正确的投资金额');
        this.formData.liabilityLimit = '';
        return
      }
      if (this.formData.liabilityLimit !== '') {

        var m = this.formData.liabilityLimit
        m *= 100;
        m += "";
        // console.log('m', m)
        var length = m.length;
        var result = "";
        for (var i = 0; i < length; i++) {
          if (i == 2) {
            result = "元" + result;
          } else if (i == 6) {
            result = "万" + result;
          }
          if (m.charAt(length - i - 1) == 0) {
            if (i != 0 && i != 1) {
              if (result.charAt(0) != '零' && result.charAt(0) != '元' && result.charAt(0) != '万') {
                result = "零" + result;
              }
            }
            continue;
          }
          result = this.toDx(m.charAt(length - i - 1)) + this.unit[this.unit.length - i - 1] + result;
        }
        result += result.charAt(result.length - 1) == '元' ? "整" : "";
        this.formData.liabilityLimits = result;
        if (this.formData.liabilityLimit < 1
        ) {
          this.$Message.error('投资金额必须大于1元');
          return
        }
        // if (this.formData.casualtiesFeeLimit > this.table.remainMoney) {
        //   this.$Message.error('不能超过可投金额');
        //   this.formData.casualtiesFeeLimit = '';
        //   return
        // }
      }
    },
    perProfit4(e) {
      // console.log('e', e)
      //输入金额时，限制小数后两位正则表达式
      var that = this;
      e = (e.match(/^\d*(\.?\d{0,2})/g)[0]) || null
      this.formData.deductible = e;
      if (!this.formData.deductible) {
        this.$Message.error('请输入正确的投资金额');
        this.formData.deductible = '';
        return
      }
      if (this.formData.deductible !== '') {

        var m = this.formData.deductible
        m *= 100;
        m += "";
        // console.log('m', m)
        var length = m.length;
        var result = "";
        for (var i = 0; i < length; i++) {
          if (i == 2) {
            result = "元" + result;
          } else if (i == 6) {
            result = "万" + result;
          }
          if (m.charAt(length - i - 1) == 0) {
            if (i != 0 && i != 1) {
              if (result.charAt(0) != '零' && result.charAt(0) != '元' && result.charAt(0) != '万') {
                result = "零" + result;
              }
            }
            continue;
          }
          result = this.toDx(m.charAt(length - i - 1)) + this.unit[this.unit.length - i - 1] + result;
        }
        result += result.charAt(result.length - 1) == '元' ? "整" : "";
        this.formData.deductibles = result;
        if (this.formData.deductible < 1
        ) {
          this.$Message.error('投资金额必须大于1元');
          return
        }
        // if (this.formData.casualtiesFeeLimit > this.table.remainMoney) {
        //   this.$Message.error('不能超过可投金额');
        //   this.formData.casualtiesFeeLimit = '';
        //   return
        // }
      }
    },
    perProfit5(e) {
      // console.log('e', e)
      //输入金额时，限制小数后两位正则表达式
      var that = this;
      e = (e.match(/^\d*(\.?\d{0,2})/g)[0]) || null
      this.formData.sinsuranceFeeCount = e;
      if (!this.formData.sinsuranceFeeCount) {
        this.$Message.error('请输入正确的投资金额');
        this.formData.sinsuranceFeeCount = '';
        return
      }
      if (this.formData.sinsuranceFeeCount !== '') {

        var m = this.formData.sinsuranceFeeCount
        m *= 100;
        m += "";
        // console.log('m', m)
        var length = m.length;
        var result = "";
        for (var i = 0; i < length; i++) {
          if (i == 2) {
            result = "元" + result;
          } else if (i == 6) {
            result = "万" + result;
          }
          if (m.charAt(length - i - 1) == 0) {
            if (i != 0 && i != 1) {
              if (result.charAt(0) != '零' && result.charAt(0) != '元' && result.charAt(0) != '万') {
                result = "零" + result;
              }
            }
            continue;
          }
          result = this.toDx(m.charAt(length - i - 1)) + this.unit[this.unit.length - i - 1] + result;
        }
        result += result.charAt(result.length - 1) == '元' ? "整" : "";
        this.formData.sinsuranceFeeCounts = result;
        if (this.formData.sinsuranceFeeCount < 1
        ) {
          this.$Message.error('投资金额必须大于1元');
          return
        }
        // if (this.formData.casualtiesFeeLimit > this.table.remainMoney) {
        //   this.$Message.error('不能超过可投金额');
        //   this.formData.casualtiesFeeLimit = '';
        //   return
        // }
      }
    },
//点击提交按钮提交数据
    getAdd(formData) {
      console.log('formData', this.formData);
      this.$refs[formData].validate((valid) => {
        if (valid) {
          updateInsureEli1(this.formData).then(res => {
            console.log('res', res);
            this.$message({
              showClose: true,
              message: res.msg,
              type: 'success'
            });
            this.$router.push({
              path:'/insurancemanagement/ListApplication'
            })
          })

        }

      })

    },
    //将所有数据清空
    // resetForm(formData){
    // this.$refs[formData].resetFields();
    // }

  },
  created() {
    this.formData.user_id = JSON.parse(localStorage.getItem('userInfo')).userId;
    //查询用工单位
    this.getSelectEmployer();
    //调用查询投保类型数据
    this.getQuer()

    // this.templateName=this.formData.templateId

    console.log('formData',formData);
    // console.log('value', this.value);

    //调用产品方案数据
    this.getListProductType();
    this.getDicts("industry_type").then(response => {
      this.typeOptions1= response.data;
      // console.log('typeOptions1',this.typeOptions1)
    });
    this.getDicts("insure_nature").then(response => {
      this.statusOptions = response.data;

    });
    this.getDicts("insure_take").then(response => {
      this.statusOptions1 = response.data;

    });
    this.getDicts("insure_situation").then(response => {
      this.statusOptions2 = response.data;

    });
    this.getDicts("insure_contract").then(response => {
      this.statusOptions3 = response.data;

    });
    this.getDicts("insure_underwriting").then(response => {
      this.statusOptions4 = response.data;

    });
    var formData=this.$route.query.insureInfo

    getInsureEli1(formData.id).then(res=>{
      console.log('详情',res);
      this.formData.insure_id=res.data.id;
      this.formData.employerId1=res.data.employer_id1;
      this.formData.employerId2=res.data.employer_id2;
      this.formData.name1=res.data.name1;
      this.formData.contactPerson1=res.data.contact_person1;
      this.formData.phone1=res.data.phone1;
      this.formData.mailAddress1=res.data.mail_address1;
      this.formData.emailCode1=res.data.email_code1;
      this.formData.email1=res.data.email1;
      this.formData.name2=res.data.name2;
      this.formData.contactPerson2=res.data.contact_person2;
      this.formData.phone2=res.data.phone2;
      this.formData.mailAddress2=res.data.mail_address2;
      this.formData.emailCode2=res.data.email_code2;
      this.formData.email2=res.data.email2;
      this.formData.nature2=res.data.nature2;
      this.formData.industry=res.data.industry;
      this.formData.address2=res.data.address2;
      this.formData.businessScope2=res.data.business_scope2;
      this.formData.staffCount2=res.data.staff_count2;
      this.formData.seniorDescription=res.data.senior_description;
      this.formData.generalDescription=res.data.general_description;
      if (res.data.is_e_l_i!=null){
        this.formData.isELI=res.data.is_e_l_i.toString();
      }
      if (res.data.is_loss_eli!=null){
        this.formData.isLossEli=res.data.is_loss_eli.toString();
      }
      this.formData.eliDesc=res.data.eli_desc;
      if (res.data.is_i_i!=null){
        this.formData.isII=res.data.is_i_i.toString();
      }

      this.formData.iiDesc=res.data.ii_desc;

      if (res.data.is_train!=null){
        this.formData.isTrain=res.data.is_train.toString();
      }

      this.formData.trainingTime=res.data.training_time;

      if (res.data.is_have_medical_staff!=null){
        this.formData.isHaveMedicalStaff=res.data.is_have_medical_staff.toString();
      }

      this.formData.medicalStaffCount=res.data.medical_staff_count;
      this.formData.hospitalDistance=res.data.hospital_distance;
      this.formData.hospitalName=res.data.hospital_name;
      if (res.data.is_join_mi!=null){
        this.formData.isJoinMi=res.data.is_join_mi.toString();
      }

      this.formData.descriptionMi=res.data.description_mi;
      this.formData.compPrincipleAndLimit=res.data.comp_principle_and_limit;
      this.formData.otherDescription=res.data.other_description;
      this.formData.insuranceTimeStart=res.data.insurance_time_start.substring(0,11);
      this.formData.insuranceTimeEnd=res.data.insurance_time_end.substring(0,11);
      this.formData.sinsuranceFeeCounts=res.data.sinsurance_fee_counts;
      this.formData.sinsuranceFeeCount=res.data.sinsurance_fee_count;
     if (res.data.pay_time!=''){

         if (res.data.pay_time!='0000-00-00 00:00:00'){

           this.formData.payTime=res.data.pay_time.substring(0,11);
         }

     }
     console.log('payTime',this.formData.payTime)
      this.formData.solution=res.data.solution;
      this.formData.seal=res.data.seal;
      if (this.formData.seal!=""){
        this.urlImage1= this.formData.seal;
        if (this.urlImage1!=''){
          this.show1=false;
        }else {
          this.show1=true;
        }
      }
      if (res.data.signing_time!=''){
        if (res.data.signing_time!='0000-00-00 00:00:00'){
          this.formData.signingTime=res.data.signing_time.substring(0,10);
        }

      }

      this.formData.underwriting=res.data.underwriting;
      this.formData.agent=res.data.agent;
      this.formData.signPolicyholder=res.data.sign_policyholder;
      if (this.formData.signPolicyholder!=""){
        this.urlImage=this.formData.signPolicyholder
        if (this.urlImage!=''){
          this.show=false;
        }else {
          this.show=true;
        }
        // console.log('a',this.formData)
      }
      if (res.data.sign_policyholder_time!=''){
        if (res.data.sign_policyholder_time!='0000-00-00 00:00:00'){
          this.formData.signPolicyholderTime=res.data.sign_policyholder_time.substring(0,10);
        }

      }

     this.ProductPlan=res.data.plan

    })
    //将int类型转换为string类型




   }

}
</script>

<style scoped lang="scss">
.insureEli_conter {
  //background: #00afff;
  overflow: hidden;
  .footer{
    position: fixed;
    right: 50px;
    bottom:80px;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    //background-color: #00afff;
  }
  .row_top {
    //background: #00afff;
    margin: 20px auto;

    .top_img {
      //background: pink;

      img {
        margin-left: 100px;
        //width: 500px;
      }
    }

    .grid-content {

      //background: #00afff;
      height: 62px;
      line-height: 62px;
      text-align: right;
      margin-right: 10px;
      min-width: 300px;
      max-width: 400px;

      span {
        margin-right: 5px;
      }
    }
  }


  .title {
    text-align: center;
    font-size: 20px;
    font-weight: bold;

    span {
      font-size: 16px;
      font-weight: normal;
      margin-left: 20px;
    }
  }

  .explain {
    text-indent: 2em;
    font-size: 14px;
    margin: 10px;

    span {
      font-weight: bold;
    }
  }

  .tem_from {
    //background: pink;
    padding: 20px;

    .infor {
      margin-top: 20px;
      //background: #4AB7BD;
      min-width: 500px;
      min-width: 100%;
      display: flex;
      flex-flow: wrap;
      align-items: center;
      //justify-content: space-between;

      .el-input {
        width: 200px;
        //background: #00afff;
      }

      .el-input1 {
        width: 250px;
      }
    }

    .infor1 {
      margin-top: 20px;
      padding-left: 20px;
    }

    .infor1_Industry {
      display: flex;
      flex-direction: column;
      //background-color: pink;
      margin: 20px 20px 40px 40px;

      span {
        display: inline-block;
        width: 150px;
        margin-bottom: 20px;

        //background-color: #00afff;
      }

    }

    .infor2 {
      display: flex;
      //background-color: pink;
      margin: 20px auto;
      align-items: center;

      span {
        display: inline-block;
        width: 240px;
        //background-color: #00afff;
      }

      .input {
        width: 80px;
        margin-right: 5px;
      }
    }
    .infor3{
      flex-direction: column;
      align-items: normal;
      box-sizing: border-box;
      padding-right: 40px;
      span{
        margin-bottom: 20px;
      }
    }

    .el-row {
      margin-bottom: 20px;
      margin: 0 20px 20px;
      display: flex;
      align-items: center;

      .input1 {
        margin-left: 20px;
      }
    }

    .grid-content {
      margin-left: 20px;
      //background-color: pink;
      //height: 35px;
      //line-height: 35px;
    }

    .grid-content2 {
      font-weight: bold;
      text-align: center;
    }

    .bg-purple {
      font-weight: bold;
    }

    .conter {
      background-color: #f1f1f1;
      border-radius: 6px;
      padding: 20px;
      margin-bottom: 20px;
    }
  }

  .yinying {
    background-color: rgba(0, 0, 0, .4);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }
}
</style>
